package com.itheima.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.domain.db.Option;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OptionMapper extends BaseMapper<Option> {

    @Select("SELECT id, question_id, content AS `option`, score FROM tb_option WHERE question_id = #{questionId}")
    List<Option> selectOptionsByQuestionId(@Param("questionId") Integer questionId);


    @Select("SELECT id, question_id, content AS `option`, score FROM tb_option WHERE id = #{optionId}")
    Option selectOneById(@Param("optionId")String optionId);

    @Select("SELECT id, question_id, content AS `option`, score FROM tb_option WHERE question_id = #{questionId} AND id = #{optionId}")
    Option selectByQuestionIdAndId(@Param("questionId") String questionId,@Param("optionId") String optionId);
}
